﻿<%@ Page Title="About Us" Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true"
	CodeBehind="About.aspx.cs" Inherits="TB.Site.About" %>


<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
	<title></title>
</head>
<body>
	<script src="Scripts/jquery-1.7.js" type="text/javascript"></script>
	<script src="Scripts/jquery-1.7.min.js" type="text/javascript"></script>
	

	<form id="form1" runat="server">
	<div>
	<h1> random message:</h1>

&nbsp;<textarea id="TextArea1" cols="20" dir="ltr" name="S1" rows="2" runat="server"></textarea> 
<br />
	&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
		by:&nbsp;&nbsp;
<input type="text" id="Author" runat="server" /><br />
		<br />
	<br />

	<asp:Label id="label1" runat="server" />
	<br />

	<div id="fb-root"></div>

<script type="text/javascript">
	var msgsList = <%= msgsList %>;
	var pagePath = window.location.pathname;
	var FBlink; 

	//parses the list
	function parseList(pos)
	{	
	if  (pos < msgsList.length)
	{
			var obj = msgsList[pos];
			TextArea1.value = obj.Content;
			Author.value = obj.Author;
			//$("fbLike").att("href") = pagePath + '?' + obj.Guid;
			$("#fbLike").attr({href : pagePath + '?' + obj.Guid});
			setTimeout(function(){parseList(++pos)}, 5000);
	}
	else
	{
	WebMethod('RefillMessages', [], AjaxSucceeded, AjaxFailed);
	}
	}
		
	parseList(0);

//--------------------------------------------------------------------------+
// jQuery call AJAX Page Method                                             |
//--------------------------------------------------------------------------+
function PageMethod(fn, paramArray, successFn, errorFn) {
	var pagePath = window.location.pathname;
	
	
	
	$.ajax({
		type: 'POST',
		url: pagePath + '/' + fn,
		contentType: 'application/json; charset=utf-8',
		data: '{}',
		dataType: 'json',
		success: successFn,
		error: errorFn
	});
}

//--------------------------------------------------------------------------+
// jQuery call AJAX WEB Method                                              |
//--------------------------------------------------------------------------+
 
function WebMethod(fn, paramArray, successFn, errorFn) {
 
	//----------------------------------------------------------------------+
	// Call the WEB method                                                  |
	//----------------------------------------------------------------------+
	$.ajax({
		type: 'POST',
		url: 'MessagesService.asmx' + '/' + fn,
		contentType: 'application/json; charset=utf-8',
		data: '{}',
		dataType: 'json',
		success: successFn,
		error: errorFn
	});
}

//---------------------------------------------+
// jQuery AJAX Call Succeeded.                 |
//---------------------------------------------+
function AjaxSucceeded(result) {
	msgsList = result;
	parseList(0);
}
 
//------------------------------------------------+
// jQuery AJAX Call FAILED.                       |
//------------------------------------------------+
function AjaxFailed(result) {
	alert('SERVICE Failed : ' + result.d);
}
 



</script>


<script>
	window.fbAsyncInit = function () {
		FB.init({
			appId: 'YOUR_APP_ID', // App ID
			channelURL: '//WWW.YOUR_DOMAIN.COM/channel.html', // Channel File
			status: true, // check login status
			cookie: true, // enable cookies to allow the server to access the session
			oauth: true, // enable OAuth 2.0
			xfbml: true  // parse XFBML
		});

		// Additional initialization code here
	};

	// Load the SDK Asynchronously
	(function (d) {
		var js, id = 'facebook-jssdk'; if (d.getElementById(id)) { return; }
		js = d.createElement('script'); js.id = id; js.async = true;
		js.src = "//connect.facebook.net/en_US/all.js";
		d.getElementsByTagName('head')[0].appendChild(js);
	} (document));
</script>
<fb:like id=fbLike href=FBlink layout="standard" show-faces="true" width="450" action="like" colorscheme="light" />



	</div>

	</form>
</body>
</html>
